#include <iostream>
#include <vector>
using namespace std;

class Solution
{
public:
    double myPow(double x, int n)
    {
        if (x == 0 || x == 1)
            return x;
        double res = 1;
        double powCache = x;

        long p;
        if (n < 0)
        {
            p = n;
            p = -p;
        }
        else
            p = n;
        while (p != 0)
        {
            if (p & 0b1)
            {
                res *= powCache;
            }
            powCache *= powCache;
            p = p >> 1;
        }
        return n < 0 ? 1 / res : res;
    }
};

int main()
{
    cout << "Code50" << endl;
    Solution s;
    cout << s.myPow(2, -1);
    return 0;
}